package com.joinway.framework.admin.core.plugin.service;

import java.util.Map;

import org.springframework.stereotype.Service;

import com.joinway.framework.admin.bean.domain.TreeMenu;
import com.joinway.framework.admin.core.service.table.TableService;
import com.joinway.framework.bean.view.View;
import com.joinway.framework.core.utils.AppEnv;

@Service
public class TreeMenuTableService extends TableService {

	@Override
	public String getTableName() {
		return "treeMenu";
	}

	@Override
	protected String getFindAllSql(String tableName) {
		return "select * from " + tableName + " where app_id = '" + AppEnv.getAppId() + "' ";
	}

	@Override
	public View save(String table, String idField, Map<String, String> params) throws Exception {
		TreeMenu treeMenu = super.getDomainEntity(params, TreeMenu.class);
		treeMenu.setAppId(AppEnv.getAppId());
		
		repository.save(treeMenu);
		
		return new View();
	}


}
